package com.jye.rseven.user.controller;


import com.jye.rseven.domain.CoursesType;
import com.jye.rseven.service.CoursesTypeService;
import com.jye.rseven.domain.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/coursesType")
@Api(tags="课程分类控制器API")
public class CoursesTypeController {

    @Autowired
    CoursesTypeService coursesTypeService;

    @GetMapping(value="/findAllCoursesType")
    @ApiOperation(value="查找全部课程分类", notes="查找全部课程分类", httpMethod = "GET")
    public JsonResult findAllCourses(){
        JsonResult jsonResult = new JsonResult();
        List<CoursesType> list = coursesTypeService.findAllCoursesType();
        if (list != null ){
            jsonResult.setData(list);
        }else{
            jsonResult.setCode("500");
            jsonResult.setMsg("查询失败");
        }
        return jsonResult;
    }
}
